//---------------------------------------------------------------------------- // File: CiMedia.h // Class: CiMedia // Type: Media Manipulations. // Author: Ken Anderson // Date: 10/13/3 // OS dependant: N/A // // Notes: CiMedia is a class which will handle multiple images and interface // to allow the user to perform transformations on each one. // // Required Headers: // 1) Bitmap.h -- Required for the bitmap file format structures. // 2) Image.h -- Contains all common image definitions & formats that are // shared amongst the several image format. // //---------------------------------------------------------------------------- #ifndef _CIMEDIA_MX_ #define _CIMEDIA_MX_ #include "Image.h" #include "Bitmap.h" typedef enum enMEDIA_TYPE {MT_IMNOTDEFINE, //The Media is not defined. MT_IMBITMAP, //The Media is a bitmap image. MT_IMJPG, //The Media is a jpg image. MT_IMPNG //The Media is a png image. } MEDIATYPE; class CiMedia { //Member variables. //private: public: void *m_vpMedia; //Our media data will be held. MEDIATYPE m_MediaType; //The type of media being used. private: void Init(); void Delete(); IM_ERROR MediaCheck(cstr pfilename); //Conversions PCIMG ConvertBMPtoCIMG(PBitmap pbmp); void UpdateBMP(PBitmap pbmp, PCIMG pcimg); //Member functions. public: //Constructor & Destructor classes CiMedia(); CiMedia(cstr pFilename); ~CiMedia(); //Operator overloading const CiMedia& operator =(const CiMedia& media); const CiMedia& operator =(const CiMedia* media); const bool operator==(const CiMedia& media) const; //Image management functions IM_ERROR Create(MEDIATYPE mt, IMFORMAT_BD format); IM_ERROR Create(MEDIATYPE mt, IMFORMAT_BD format, int nHeight, int nWidth, void* pvPalette, void* pvBits); IM_ERROR Copy(CiMedia* pMedia); IM_ERROR LoadMedia(cstr pfilename); IM_ERROR WriteMedia(cstr pfilename); IM_ERROR ReloadMedia(cstr pfilename); IM_ERROR ConvertColorDepth(IMFORMAT_BD BitDepth); //Data management. void* RetrieveImageBitsRGB(); ColorARGB* RetrievePalette(); //Properties long GetWidth(); long GetHeight(); Word GetBitCount(); long GetWidthBytes(); void* GetMedia(); MEDIATYPE GetMediaType() {return m_MediaType;} //Transformation functions IM_ERROR MergeImage(CiMedia *pCiMedia, long xOffset, long yOffset, Color4 ClipColor, float fAlpha, float fAlpha2); IM_ERROR MergeImage(CiMedia *pCiMedia, long xOffset, long yOffset, float fAlpha, float fAlpha2); IM_ERROR ShadowImage(CiMedia *pCiMedia, long xOffset, long yOffset, Color4 ClipColor, float fShadow); IM_ERROR ShadowImage(CiMedia *pCiMedia, long xOffset, long yOffset, float fShadow); IM_ERROR StretchImage(long Width, long Height, IM_METHOD impixel=IMMETHOD_PIXEL); IM_ERROR InvertImage(); IM_ERROR InvertImage(Color4 ClipColor); IM_ERROR ReverseImage(); IM_ERROR ReverseImage(Color4 ClipColor); }; #endif